package com.wdd.atcrowdfunding.manager.controller;

import com.wdd.atcrowdfunding.bean.Icon;
import com.wdd.atcrowdfunding.manager.service.IconService;
import com.wdd.atcrowdfunding.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/icon")
public class IconController {

    @Autowired
    private IconService iconService;

    @ResponseBody
    @RequestMapping("/getIcon")
    public AjaxResult getIcon(){
        AjaxResult ajaxResult = new AjaxResult();

        try {
            List<Icon> icons = iconService.queryAllIcon();
            System.out.println(icons);

            ajaxResult.setSuccess(true);
            ajaxResult.setData(icons);

        } catch (Exception e) {
            ajaxResult.setSuccess(false);
            ajaxResult.setMessage("获取许可图标失败!");
        }


        return ajaxResult ;
    }
}
